//类型
// number string boolean 10(字面量) symbol  undefined null
// any unknown(未知类型，比any安全) void never(不存在)
// enum object(一般不使用) array tuple enum
/**
 * any类型变量可以赋值给任意类型，unknown类型仅可赋值给unknown类型
 *
 */
interface HasName {
  name: string;
  [key: string]: any; //索引签名
}
let obj1: HasName = { name: "xia", age: 12 };

// 函数/方法
interface FunAdd {
  (a: number, b: number): number;
}
let add: FunAdd = (a, b) => {
  return a + b;
};

// 元组
type TupleA = [string, ...number[], boolean];

// 枚举
enum Gender {
  Male = "男",
  Female = "女",
}
console.log(Gender.Male);

// 交叉类型
type A_B = { name: string } & { age: number };
let ab: A_B = { name: "zhang", age: 18 };
